import { mapState, mapGetters, mapMutations, mapActions} from "vuex";
export default {
  data() {
    return {
      selectedCustomerInfo: {},
      radioA: '',
      orderItemsVisible: false,
      custorder: {},
      currentPage: 1, //当前页码
    }
  },
  props: {},
  mounted() {
  },
  created() {
  },
  computed: {
    ...mapState("user", ["user"]),
    ...mapGetters(["conditions", "datasource", "ceilOrderType", "currCard"]),
    ...mapState("orders", [
      "orderType",
      "qryType",
      "qryValue",
      "orderStage",
      "stage",
      "listLoading"]),
  },
  methods: {
    selectedCustomer(e) {
      this.$emit("selectedCustomer", e);
    },
    open1() {
      this.dialogVisible = true;
    },
    ...mapMutations("orders", ["SET_PAGESIZE", "SET_PAGEINDEX"]),
    ...mapActions("orders",
        [
          "qryPendingOrderList",
          "clearQryConditions",
          "qryPendingOrderItemList",
          "qryPendingOrderTree"]),
    findMessage(id) {
      this.$emit("findMessage", id);
    },

    /**
     * 功能树我的订单时，客户-产品，传回所选产品的数据时调用
     */
    productChange(product) {

      this.$store.commit("orders/SET_ORDERTYPE", "");
      //通过产品信息查询销售品信息，并更改卡片类型为：OrderItemCard
    },

    /**
     * 显示销售品列表
     */
    async showSaleInfo(custorder) {
      this.custorder = custorder;
      let {orderAuditId, custId, custOrderId} = custorder;

      //该接口废弃
      // this.qryOrderItem({ custOrderId:custorder.custOrderId });
      const condition = {
        orderAuditId,
        custId,
        custOrderId,
        orderStage: this.orderStage,
        stage: this.stage,
        orgId: this.user.orgId,
        systemUserId: this.user.acctId,
        staffId: this.user.staffId,
        dealType: this.conditions.dealType,
        pageInfo: {
          pageIndex: this.currentPage,
          pageSize: 10
        },
      };

      localStorage.setItem("selectCardCondition", JSON.stringify(condition));

      if (this.qryValue) {
        //可欣:查询条件文本框中没值,这两个参数不要传
        // condition.qryType = this.qryType;
        // condition.qryValue = this.qryValue;
      }
      this.qryPendingOrderItemList(condition);
      this.orderItemsVisible = true;
    }
  }
}
